package com.zyz.N_反射机制.基本应用.创建运行时类的对象;

/**
 * @author: vick
 * @Date: 2025/4/14
 * @Description:
 * @version: 1.0
 */
public class Test {
    public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
        //获取class对象
        Class<?> clazz = Class.forName("com.vick.N_反射机制.基本应用.创建运行时类的对象.Person");
        //2. 调用 newInstance() 创建对象， 必须有无参构造器
        Object object = clazz.newInstance();
        System.out.println(object);
    }
}
